package com.global;

import android.content.Context;
import android.os.Environment;


import java.io.File;

/**
 * Created by faraway on 22/2/17.
 */
public class Global {

    /**
     * 文件路径
     */
    private static String globalPath;

    /**
     * 屏幕密度
     */
    public static float density = 1;

    public static void init(Context context) {

        String string = Environment.getExternalStorageDirectory().getAbsolutePath();
        globalPath = string + File.separator + "BaiNuoLive" + File.separator;
        File file = new File(globalPath);
        if (!file.exists()) {
            file.mkdir();
        }

        density = context.getResources().getDisplayMetrics().density;
    }

    public static String getPathWithRoot(String subPath){
        if (globalPath == null)
            init(com.blankj.utilcode.utils.Utils.getContext());

        String path = globalPath+subPath;
        File file = new File(path);
        if (!file.exists()){
            file.mkdir();
        }

        return path;
    }

}
